package com.chuangjiangx.member.coupon.ddd.domain.model;

import lombok.Getter;

/**
 * Created by zhoufushou on 2017/12/16.
 * 卡券使用时段
 */
@Getter
public enum UseType {
    ALL("全部时段", (byte)1),
    INTERVAL("固定时段", (byte)2);

    public final String name;
    public final Byte code;

    UseType(String name, Byte code) {
        this.name = name;
        this.code = code;
    }

    public static UseType get(Byte code){
        for(UseType back : values()){
            if(back.code.equals(code)){
                return back;
            }
        }
        return null;
    }
}